
/**

此js是Echarts基本的配置项，动态数据由main.js异步传入。
配置项接口文档：http://echarts.baidu.com/option.html
*/


function myconfig(topUP,bg_img,my_dataset){

option = {
     title: {
        text: my_title,
        backgroundColor: {
                image: bg_img,
                repeat: 'repeat'
                },
        textStyle :{
            fontStyle :'normal',
            align :'center',
            verticalAlign :'middle',
            color: '#CD1F1F',
            fontSize: 30,
            textShadowBlur: 5,
            textShadowColor: '#000',
            textShadowOffsetX: 5,
            textShadowOffsetY: 5,
            textBorderColor: '#333',
            textBorderWidth: 1
        },
   
        padding: [
            0,  // 上
            100, // 右
            3,  // 下
            100, // 左
        ],
        left:'center',
        top:'top',
        subtext :my_subtext,
        subtextStyle  :{
            color: '#fff',
            fontSize: 16,
            textShadowBlur: 2,
            textShadowColor: '#000',
            textShadowOffsetX: 0,
            textShadowOffsetY: 1,
            textBorderColor: '#333',
            textBorderWidth: 2
        },
    },

    tooltip: {
        showContent :false,//提示工具
        trigger: 'axis',
        axisPointer: {
            type: 'shadow',
        }
    },

    grid: {
        left: 150
    },
    toolbox: {
        show: false,
        feature: {
            saveAsImage: {show: true
            },
            magicType: {
                type: ['line', 'bar', 'stack', 'tiled']//工具栏
            },
            dataView: {show: true, readOnly: false},
            restore: {},
        },

    },
    dataset: {
                source:
                    my_dataset
            },

    xAxis: {
        type: 'value',
        /*name: '人气值',*/
        min: function(value) {
        return value.min-1000;
        },
        axisLabel: {
            formatter: '{value}',
            color: '#fff',
            fontSize: 15
        },
        splitLine :{
            show:false
        }
    },
    yAxis: {
        type: 'category',
        inverse: true,
        axisTick:{
            show:false
        },

       /* max: 'dataMax',*/
        axisLabel: {

          formatter: function (value) {
                return  value ;
            },
            margin: 5,
            color: function (value, index) {                                    
                    return color_list[index];
            },
            fontSize: 16,
            textShadowBlur: 2,
            textShadowColor: '#000',
            textShadowOffsetX: 0,
            textShadowOffsetY: 1,
            textBorderColor: '#333',
            textBorderWidth: 5,          
            
        }
    },


 graphic: [

        {
            type: 'group',
            /*rotation: Math.PI / 4,
            bounding: 'raw',*/
            right: 100,
            bottom: 0,
            z: 100,
            children: [
                {
                    type: 'text',
                    left: 'center',
                    top: 'center',
                    z: 100,
                    style: {
                        fill: '#fff',
                        text: "\n"+author+"\n\n"+"Theme By ResetDay",
                        font: 'bold 12px Microsoft YaHei'
                    }
                }
            ]
        }
    ],



    series: [
          {
            type: 'bar',
            name: my_dataset[0].y_name,

            //柱形图宽度

            barWidth :35,


           /* large:true,
            largeThreshold:400,
            progressive:5000,
            progressiveThreshold:3000,
            progressiveChunkMode:'mod',
            /*
            animationDuration: function (idx) {
                // 越往后的数据延迟越大
                return idx * 200;
            },
            */
           /*animationDelay: function (idx) {
                return idx + 10;
            },
            */
            animationDurationUpdate: function (idx) {
                // 越往后的数据延迟越大
                return idx * 300;
            },
            //动画效果：http://www.echartsjs.com/gallery/editor.html?c=line-easing

            /*
            sinusoidalInOut sinusoidalOut quinticOut cubicOut quadraticOut linear
            */
            animationEasingUpdate :'sinusoidalInOut',

            itemStyle: {
                 emphasis: {
                        barBorderRadius: 100
                    },
            normal: {
                  barBorderRadius: 100,
                  color: function (params){

                        return  new echarts.graphic.LinearGradient(
                            0, 0, 1, 0,
                            [
                                {offset: 0, color: color_list[params.dataIndex]},
                                {offset: 1, color: color_list[params.dataIndex+1]}

                            ]
                        );
                    },
                    shadowColor: '#204BD1',
                    shadowBlur: 20
             }
           },
            label: {
                normal: {
                    show: true,
                    formatter: '{a|{@x_value}}{b|【{b}：{@title}】}',
                    position: 'right',
                    rich: {
                            a: {
                                position: 'right',
                                color: '#fff',
                                fontSize: 30,
                                textShadowBlur: 2,
                                textShadowColor: '#000',
                                textShadowOffsetX: 0,
                                textShadowOffsetY: 1,
                                textBorderColor: '#333',
                                textBorderWidth: 2
                            },
                            b: {
                                 color: '#fff', 
                                 fontSize: 30,                      
                                 textBorderWidth: 1,
                                 align: 'right',
                                 
                            }
                        }
                }

            },    
            encode: {
                // Map the "x_value" column to X axis.
                x: 'x_value',
                // Map the "y_name" column to Y axis
                y: 'y_name',
                /*seriesName:'y_name',*/
                itemId:'y_name'
            },
            markPoint: {
                symbolSize: 1,
                symbolOffset: [0, '50%'],
                label: {
                   normal: {
                   
                        formatter: '{a|{a}}\n}{b|{b}}{c|{c}}',
                        backgroundColor: 'rgb(242,242,242)',
                        borderColor: '#aaa',
                        borderWidth: 2,
                        borderRadius: 4,
                        padding: [4, 10],
                        lineHeight: 40,
                   
                        shadowBlur: 5,
                        shadowColor: '#000',
                        shadowOffsetX: 0,
                        shadowOffsetY: 1,
                        position: 'inside',
                        distance: 10,
                        backgroundColor: {
                            image:bg_img,
                            },
                        rich: {
                            a: {
                                align: 'center',
                                color: '#fff',
                                fontSize: 25,
                                textShadowBlur: 2,
                                textShadowColor: '#000',
                                textShadowOffsetX: 0,
                                textShadowOffsetY: 1,
                                textBorderColor: '#333',
                                textBorderWidth: 2
                            },
                            b: {
                                color: '#f00',
                                 fontSize: 21,
                                 textBorderWidth: 1,
                                 align: 'center',
                                  textBorderColor: '#000',
                            },
                            c: {
                                color: '#f00',
                                textBorderColor: '#000',
                                textBorderWidth: 1,
                                fontSize: 30
                            }
                        }
                   }
                },
                data: [
                    {type: 'max',name: '人气: '},            
                   /*{type: 'average', name: '平均人气:'},
                    {type: 'min', name: '最低人气:'}*/
                ]
            }
        }
    ]
};
return option;
};

